#include "mythread.h"
#include<QDebug>
#include<QThread>
QMutex mythread::mutex;
int mythread::num=0;



mythread::mythread(QObject *parent):QThread(parent)
{

}

void mythread::run()
{
    while(1)
    {
//        mutex.lock();
        QMutexLocker lock(&this->mutex);
        qDebug()<<"current thread"<<this<<"num: "<<this->num++;
//        mutex.unlock();
        sleep(1);
    }
}
